#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
// priority_queue<int, vector<int>, less<int>> pq;

void solve() {
    int n; cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for(auto x : s) if(x == '_') cnt++;
    int p = n - cnt;
    int x1, x2;
    if(p & 1) x1 = p / 2, x2 = p / 2 + 1;
    else x1 = p / 2, x2 = p / 2;
    // cout << x1 << ' ' << x2 << endl;
    int ans = cnt * (x1 * x2);
    cout << ans << endl;

}

signed main() {
    int t; cin >> t;
    while(t--) solve();
    return 0;
}